﻿using Android.Views;

namespace Moven.Droid.Renderers
{
	public static class AlignmentExtensions
	{
		//
		// Static Methods
		//
		internal static GravityFlags ToHorizontalGravityFlags(this Xamarin.Forms.TextAlignment alignment)
		{
			if (alignment == Xamarin.Forms.TextAlignment.Center)
			{
				return GravityFlags.AxisSpecified;
			}
			if (alignment != Xamarin.Forms.TextAlignment.End)
			{
				return GravityFlags.Left;
			}
			return GravityFlags.Right;
		}

		internal static GravityFlags ToVerticalGravityFlags(this Xamarin.Forms.TextAlignment alignment)
		{
			if (alignment == Xamarin.Forms.TextAlignment.Start)
			{
				return GravityFlags.Top;
			}
			if (alignment != Xamarin.Forms.TextAlignment.End)
			{
				return GravityFlags.CenterVertical;
			}
			return GravityFlags.Bottom;
		}
	}
}
